package com.itheima.health.controller;

import com.itheima.health.common.MessageConst;
import com.itheima.health.entity.Result;
import com.itheima.health.service.MobileValidateCodeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/mobile/validateCode")
@Slf4j
public class MobileValidateCodeController {
   @Autowired
    MobileValidateCodeService mobileValidateCodeService;
   @Autowired
    RedisTemplate redisTemplate;
    /**
     * 发送验证码
     *
     * @param type      验证码类型，用于区分不同的业务
     * @param telephone 手机号
     * @return
     */
   @PostMapping("/send")
    public Result send(String type,String telephone){
       mobileValidateCodeService.sendValidateCode(type,telephone);
       return new Result(true, MessageConst.SEND_VALIDATECODE_SUCCESS);

   }

}
